package com.woniuxy.service.impl;

import ch.qos.logback.core.net.SyslogOutputStream;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.entity.Model;
import com.woniuxy.entity.ModelItem;
import com.woniuxy.mapper.ModelItemMapper;
import com.woniuxy.mapper.ModelMapper;
import com.woniuxy.service.ModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Service
public class ModelServiceImpl extends ServiceImpl<ModelMapper, Model> implements ModelService {
    @Autowired
    private ModelMapper modelMapper;
    @Autowired
    private ModelItemMapper modelItemMapper;
    public void add(Model model){
        Model model1 = new Model();
        ModelItem modelItem = new ModelItem();
        String name = model.getName();

        model1.setName(name);
        modelMapper.insert(model1);

}

    @Override
    public int getIdByName(String name) {
        int modelId = modelMapper.getIdByName(name);
        return modelId;
    }

    @Override
    public List<Model> getAll() {
        return modelMapper.getAll();
    }




}
